package com.yingxue.demo.controller;

import com.yingxue.demo.service.PermissionService;
import com.yingxue.demo.util.ResultVOUtil;
import com.yingxue.demo.vo.resp.ResultVO;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Package: com.yingxue.demo.controller
 * @Author: Mr.Waves
 * @Date: 2020-04-01 10:03
 * @Description:
 **/
@Api(tags = "菜单权限管理接口")
@RestController
@RequestMapping("api")
public class PermissionController {
    @Autowired
    private PermissionService permissionService;

    /*
     * 获取所有权限列表
     */
    @GetMapping("permissions")
    public ResultVO listAllPermissions() {
        return ResultVOUtil.success(permissionService.listAll());
    }

    /*
     * 获取菜单权限树
     */
    @GetMapping("permissionTree")
    public ResultVO getPermissionTree() {
        return ResultVOUtil.success(permissionService.getPermissionTree());
    }
}
